/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.projektjava;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 *
 * @author Michal Polkorab
 */
@Entity
public class Car implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private String spz;
    // spz je jednoznacny identifikator vozidla
    
    private String type;
    // type urcuje typ vozidla - limuzina,sedan,combi
    private String colour;
    // colour je farba vozidla
    private int numberOfSeats;
    // numberOfSeats je pocet miest pre na sedenie
    private int available;
    // available oznacuje ci je vozidlo dostupne - 1 k dispozicii, 2 v servise, ...
  
    
    //@OneToMany
    private Reservation reservation;
    
    //@ManyToOne
    private Company company;
   
    public String getSpz() {
        return spz;
    }
      
    public void setSpz(String spz) {
        this.spz = spz;
    }
    
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getColour() {
        return colour;
    }

    public void setColour(String colour) {
        this.colour = colour;
    }

    public int getNumberOfSeats() {
        return numberOfSeats;
    }

    public void setNumberOfSeats(int numberOfSeats) {
        this.numberOfSeats = numberOfSeats;
    }

    public int getAvailable() {
        return available;
    }

    public void setAvailable(int available) {
        this.available = available;
    }
    
    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (spz != null ? spz.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Car)) {
            return false;
        }
        Car other = (Car) object;
        if ((this.spz == null && other.spz != null) || (this.spz != null && !this.spz.equals(other.spz))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vozovypark.Car[ id=" + spz + " ]";
    }
    
}
